package cn.edu.ctbu.api01.repository;
import cn.edu.ctbu.api01.domain.Student;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface StudentRepository extends JpaRepository<Student,Integer> {
    List<Student> findByNameLike(String name);//按名字查询
//    @Query("SELECT t FROM tb_student t WHERE SUBSTRING(t.no, 1, 4) = (SELECT MAX(SUBSTRING(tt.no, 1, 4)) FROM tb_student tt) ORDER BY t.no DESC")
//    List<Student> findStudentsWithMaxNo();
    public Page<Student> findAll(Pageable pageable);
};